]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Only activate items that still have the pointer
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 19 Apr 2023 10:08:53 +0000 (12:08 +0200)
committerMarge Bot <marge-bot@gnome.org>
Thu, 20 Apr 2023 12:15:45 +0000 (12:15 +0000)
After the introduction of implicit grabs in Clutter, a release
event will now always be delivered to the actor that received
the corresponding press event.

This results in surprising behavior when moving the pointer
while pressed, as a button release will always activate the
original item, even when the pointer moved to a different item
or outside the menu altogether.

Address this by checking the hover state (that is, whether
the item contains the pointer actor) before activating it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6606

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2740>

js/ui/popupMenu.js

index 2f57c58310a910e752542776ca7285390618a6cf..c5fecc0ae8957b83be167a599cecfa780ad1ac9d 100644 (file)
@@ -138,6 +138,11 @@ var PopupBaseMenuItem = GObject.registerClass({
             return Clutter.EVENT_PROPAGATE;
 
         this.remove_style_pseudo_class('active');
+
+        // Pointer left the item during the grab
+        if (!this.hover)
+            return Clutter.EVENT_PROPAGATE;
+
         this.activate(Clutter.get_current_event());
         return Clutter.EVENT_STOP;
     }